
// preset form values if we receive a userdata object //
- user = typeof(udata) != 'undefined' ? udata : {}
// store the userId on the client side in a hidden input field //
input(type='hidden', value= user._id)#userId

#account-form-container
	form( method="post")#account-form.form-horizontal.well.span6
		h1
		p#sub1.subheading Please tell us a little about yourself.
		hr
		fieldset
			#name-cg.control-group
				label.control-label(for='name-tf') Name
				.controls
					input#name-tf.input-xlarge(type='text', name='name', value= user.name)
			#email-cg.control-group
				label.control-label(for='email-tf') Email
				.controls
					input#email-tf.input-xlarge(type='text', name='email', value= user.email)
			#clist-cg.control-group
				label.control-label(for='country-list') Location
				.controls
					select#country-list(name='country')
						each item in countries
							option(selected=item.name == user.country)= item.name
			hr
			#utlist-cg.control-group
				label.control-label(for='usertype-list') UserType
				.controls
					select#usertype-list(name='usertype')
						each item in usertypes
							option(selected=item.name == user.usertype)= item.name
			hr
			p#sub2.subheading
			#user-cg.control-group
				label.control-label(for='user-tf') Username
				.controls
					input#user-tf.input-xlarge.disabled(type='text', name='user', value= user.user)
			#pass-cg.control-group
				label.control-label(for='pass-tf') Password
				.controls
					input#pass-tf.input-xlarge(type='password', name='pass', value='')
			.form-actions
				button(type='button')#account-form-btn1.btn
				button(type='submit')#account-form-btn2.btn

// display form errors in a custom modal window //

include modals/form-errors

script(src='/vendor/jquery.min.js')
script(src='/vendor/jquery.form.js')
script(src='/vendor/bootstrap-modal.js')
script(src='/vendor/bootstrap-transition.js')
script(src='/js/form-validators/accountValidator.js')